<template>

  <item-title title="基本信息" />

  <infomation-view :datas="datas.order" />

  <item-title title="订单产品" />

  <order-product-view :datas="datas" />

  <item-title title="操作记录" style="margin-top: 20px"/>

  <operation-view
    :id="id"
    mode="order"
  />

</template>

<script>
import infomationView from '../../../orderAndReturned/order/detail/modules/infomationView'
import orderProductView from '../../../orderAndReturned/order/detail/modules/orderProductView'
import {defineComponent, inject, onMounted, reactive, toRefs} from 'vue'

export default defineComponent({
  name: 'OrderInfo',
  components: { infomationView, orderProductView },
  props: {
    id: {
      type: Number,
      default: 0,
    },
  },
  setup(props) {
    const api = inject('api')
    var data = reactive({
      datas: {
          order: {
              isSplit: 0
          },
          orderDetail: []
      },
    })

    const getData = () => {
      api.order.GET_ORDER_DETAIL(props.id).then((res) => {
        if (!res.code && res.data) {
          data.datas = res.data.order
        }
      })
    }

    onMounted(() => {
      getData()
    })

    return {
      ...toRefs(data),
    }
  },
})
</script>

<style scoped>
</style>
